
package org.bridgen.lang.semantics.ast;
import java.util.*;


 
/* Insertion rules */


public abstract class InsertionRule extends ASTNode<ASTNode> implements Cloneable {
    public void flushCache() {
        super.flushCache();
    }
     @SuppressWarnings({"unchecked", "cast"})  public InsertionRule clone() throws CloneNotSupportedException {
        InsertionRule node = (InsertionRule)super.clone();
        node.in$Circle(false);
        node.is$Final(false);
    return node;
    }
    // Declared in TypeCodeGen.jrag at line 636

	
	public void generateMethod_possibleSite(String indent, StringBuffer buf) {
		buf.append(indent + "Island newIsland = constructFakeIsland(node, false);\n");
		if (getRelation().isAfter()) {
			buf.append(indent + "RecoveryHelper.insertAfter(newIsland, ");
		} else {
			buf.append(indent + "RecoveryHelper.insertBefore(newIsland, ");
		}
		buf.append(getPatternUse().getName() + ");\n");
		buf.append(indent + "newIsland.buildBridge(this, -1);\n");
		buf.append(indent + "return true;\n");
	}

    // Declared in bridgit.ast at line 3
    // Declared in bridgit.ast line 123

    public InsertionRule() {
        super();


    }

    // Declared in bridgit.ast at line 10


    // Declared in bridgit.ast line 123
    public InsertionRule(Relation p0, PatternUse p1) {
        setChild(p0, 0);
        setChild(p1, 1);
    }

    // Declared in bridgit.ast at line 15


  protected int numChildren() {
    return 2;
  }

    // Declared in bridgit.ast at line 18

  public boolean mayHaveRewrite() { return false; }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 123
    public void setRelation(Relation node) {
        setChild(node, 0);
    }

    // Declared in bridgit.ast at line 5

    public Relation getRelation() {
        return (Relation)getChild(0);
    }

    // Declared in bridgit.ast at line 9


    public Relation getRelationNoTransform() {
        return (Relation)getChildNoTransform(0);
    }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 123
    public void setPatternUse(PatternUse node) {
        setChild(node, 1);
    }

    // Declared in bridgit.ast at line 5

    public PatternUse getPatternUse() {
        return (PatternUse)getChild(1);
    }

    // Declared in bridgit.ast at line 9


    public PatternUse getPatternUseNoTransform() {
        return (PatternUse)getChildNoTransform(1);
    }

    // Declared in PrettyPrint.jrag at line 24
 @SuppressWarnings({"unchecked", "cast"})     public String indent() {
        String indent_value = getParent().Define_String_indent(this, null);
        return indent_value;
    }

public ASTNode rewriteTo() {
    return super.rewriteTo();
}

}
